#ifndef SK_GAME_ITEM_PROPERTY_H
#define SK_GAME_ITEM_PROPERTY_H

#include <QString>
#include <QStyleOption>
#include <QVector>
#include <QStringList>

class QWidget;

namespace sk
{
class GameItem;

class GameItemProperty
{
public:
    GameItemProperty(GameItem * i, QString n);
    virtual QString valueToString();
    virtual QWidget * createEditor(QWidget * parent);
    virtual void setEditorData(QWidget * editor);
    virtual void setPropertyData(QWidget * editor);
    virtual void paint(QPainter * painter, const QStyleOptionViewItem &option);

    GameItem * item;
    QString name;
};

class GameItemFloatProperty : public GameItemProperty
{
public:
    GameItemFloatProperty(GameItem * i, QString n, float * d);
    virtual QString valueToString();
    virtual QWidget * createEditor(QWidget * parent);
    virtual void setEditorData(QWidget * editor);
    virtual void setPropertyData(QWidget * editor);
    float * data;
};

class GameItemIntProperty : public GameItemProperty
{
public:
    GameItemIntProperty(GameItem * i, QString n, int * d);
    virtual QString valueToString();
    virtual QWidget * createEditor(QWidget * parent);
    virtual void setEditorData(QWidget * editor);
    virtual void setPropertyData(QWidget * editor);
    int * data;

    bool bitEditor;
    int  numBits;
};

class GameItemShortProperty : public GameItemProperty
{
public:
    GameItemShortProperty(GameItem * i, QString n, short * d);
    virtual QString valueToString();
    virtual QWidget * createEditor(QWidget * parent);
    virtual void setEditorData(QWidget * editor);
    virtual void setPropertyData(QWidget * editor);
    short * data;
};

class GameItemEnumProperty : public GameItemProperty
{
public:
    GameItemEnumProperty(GameItem * i, QString n, int * d, QStringList& ns, QVector<int>& es);
    virtual QString valueToString();
    virtual QWidget * createEditor(QWidget * parent);
    virtual void setEditorData(QWidget * editor);
    virtual void setPropertyData(QWidget * editor);
    int * data;
    QStringList names;
    QVector<int> enums;
};

class GameItemBoolProperty : public GameItemProperty
{
public:
    GameItemBoolProperty(GameItem * i, QString n, bool * d);
    virtual QString valueToString();
    virtual QWidget * createEditor(QWidget * parent);
    virtual void setEditorData(QWidget * editor);
    virtual void setPropertyData(QWidget * editor);
    bool * data;
};

class GameItemColorProperty : public GameItemProperty
{
public:
    GameItemColorProperty(GameItem * i, QString n, QColor * d);
    virtual QString valueToString();
    virtual QWidget * createEditor(QWidget * parent);
    virtual void setEditorData(QWidget * editor);
    virtual void setPropertyData(QWidget * editor);
    QColor * data;
};

} // namespace sk

#endif // SK_GAME_ITEM_PROPERTY_H
